package com.rd.sys.common.threadpool.block;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.TimeUnit;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * The Class M2MThreadPoolExecutor.
 */
public class BlockingThreadPoolExecutor extends java.util.concurrent.ThreadPoolExecutor {

    /** The Constant logger. */
    private static final Logger logger = LoggerFactory.getLogger(BlockingThreadPoolExecutor.class);

    /**
     * Instantiates a new m2 m thread pool executor.
     * 
     * @param paramInt1
     *            the param int1
     * @param paramInt2
     *            the param int2
     * @param paramLong
     *            the param long
     * @param paramTimeUnit
     *            the param time unit
     * @param paramBlockingQueue
     *            the param blocking queue
     * @param paramRejectedExecutionHandler
     *            the param rejected execution handler
     */

    public BlockingThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit,
            BlockingQueue<Runnable> workQueue, RejectedExecutionHandler paramRejectedExecutionHandler) {
        super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, paramRejectedExecutionHandler);
    }

    /**
     * After execute.
     * 
     * @param r
     *            the r
     * @param t
     *            the t
     * @version
     */
    @Override
    protected void afterExecute(Runnable r, Throwable t) {
        super.afterExecute(r, t);
        synchronized (r) {
            r.notify();
        }
    }
}
